package com.dpj.park_test;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

@Slf4j(topic = "c.ParkDemo")
public class ParkDemo {
    public static void main(String[] args) throws InterruptedException {
       Thread t1= new Thread(()->{
            log.debug("start..");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("park");
            LockSupport.park();
            log.debug("resume");
        },"t1");
       t1.start();


        Thread.sleep(2000);
        log.debug("unpark");
        LockSupport.unpark(t1);
    }
}
